1. Field of the Invention
The present invention relates to computer graphics. More particularly, it relates to generating a digital image having spatially varying effects.
2. Related Art
In computer graphics, spatially varying effects such as blurring are important effects that contribute to the overall realism of digital images. Blurring adds to the realism of digital images because only one plane in a real image, the focal plane, can be in focus at any given instance in time. The farther an object is located from the focal plane in a real image, the more out of focus or blurry it is. Blurring also adds to the realism of a sequence of digital images. Motion-blurred objects in a sequence of digital images appear to be moving to an observer of the sequence. Being able to quickly generate a sequence of digital images having spatially varying effects is particularly important, especially in computer animation.
Conventionally, digital images having spatially varying effects, such as blurring, have been generated by combining several copies of an object to be blurred into a single image. For example, a stationary object in a digital image can be blurred to simulate focal plane effects by generating several slightly displaced copies of the object and blending the pixels of these copies of the object to form a single blurred image of the object. Similarly, motion-burring can be simulated in a digital image by generating several copies of an object to be motion-blurred and blending the pixels of the copies of the object with the pixels of a digital image scene. In this case, each copy of the object to be motion-blurred is slightly displaced from the other copies of the object along a particular path of motion.
While known methods for simulating spatially varying effects in digital images are useful in certain circumstances, these known methods cannot be implemented at interactive rates on graphics machines. Known methods for simulating spatially varying effects in digital images are highly dependent on scene complexity and geometric complexity. Rendering a complex digital image for screen display typically requires multiple passes through a graphics pipeline. Each pass through a graphics pipeline takes a finite amount of time. The time required to render any digital image for screen display also generally increases with the complexity of the image. Because known methods for generating digital images having spatially varying effects are highly dependent on image complexity, i.e, these methods render several copies of each image to be blurred, these known methods cannot be implemented on interactive graphics machines.
What is needed is a method, system, and computer program product for generating digital images having spatially varying effects that can be implemented at an interactive rate on a graphics machine.
The present invention provides a method, system, and computer program product for generating a digital image having spatially varying effects. In one embodiment, a preexisting source image is selected and used to generate a three-dimensional texture volume by convolving the pixels of the selected source image with a predetermined convolution kernel. A display image having spatially varying effects is then generated using the pixels of the three-dimensional texture volume and the pixels of a reference image, where each pixel of the reference image acts as an index to the pixels of the three-dimensional texture volume. The display image may be generated by either copying pixels from the three-dimensional texture volume to a frame buffer or by blending pixels from the three-dimensional texture volume with the pixels of an image already stored in the frame buffer.
In an embodiment of the present invention, the image planes of the three-dimensional texture volume are generated by convolving the pixels of the source image with a box-type filter. In another embodiment, the image planes of the three-dimensional texture volume are generated by convolving the pixels of the source image with a Gaussian-type filter. Image planes of the three-dimensional texture volume can also be generated using an image plane of the three-dimensional texture volume itself.